package logic

import (
	"core/command"
	"time"
)

// player消息注册
func (player *Player) registerMsgHandler() {
	player.router.Register(uint16(command.Command_CSStartPvp_Pvp), player.startPvpHandler)
	player.router.Register(uint16(command.Command_CSCancelPvp_Pvp), player.cancelPvpHandler)
}

func (player *Player) registerInnerMsgHandler() {
	//player.innerRouter.Register()
}

func (pp *PvpPool) registerTimerHandler() {
	pp.Timer.RegTimer(pp.pvpMatchPlayer, 1*time.Second)
	pp.Timer.RegTimer(pp.checkPvpPlayerCanJoinExtraPool, 1*time.Second)
}

// RoomSrv消息注册
func (rSv *RoomSrv) registerRoomSrvHandler() {
	rSv.Router.RegisterRoomSrv(uint16(command.Command_CSOutOfCards_Pvp), rSv.outOfCardHandler)
	rSv.Router.RegisterRoomSrv(uint16(command.Command_CSChatMsg_Online), rSv.chatMsgHandler)
}

func (rSv *RoomSrv) registerRoomSrvTimer() {
	rSv.timer.RegTimer(rSv.checkOutOfCardTimeOut, 500*time.Millisecond)
	rSv.timer.RegTimer(rSv.judgeRoomRealPlayerNum, 1*time.Second)
}

// world消息注册
func (world *World) registerWorldHandler() {
	world.router.Register(uint16(command.Command_PlayerIntoPvp_Server), world.playerIntoPvpServerHandler)
	world.router.Register(uint16(command.Command_PlayerLeavePvp_Server), world.playerLeavePvpSeverHandler)
}
